﻿namespace ACCOUNTING.LVY.Business
{
    using ACCOUNTING;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Data;
    using System.Windows.Forms;

    public class clsChungTuTongHopChiTiet
    {
        private string mDiaChiThue = "";
        private string mDienGiai = "";
        private string mKhoa = "";
        private string mKhoaBoPhan = "";
        private string mKhoaChungTu = "";
        private string mKhoaChungTuThamChieu = "";
        private string mKhoaDoiTuong = "";
        private string mKhoaDoiTuongThue = "";
        private string mKhoaHopDong = "";
        private string mKhoaLoaiChungTu = "";
        private string mKhoaLoaiThue = "";
        private string mKhoaSanPham = "";
        private string mKhoaTaiKhoan = "";
        private string mKhoaTaiKhoanThue = "";
        private string mLoaiTien = "";
        private string mMaSoThue = "";
        private string mNgayChungTuThamChieu = "";
        private string mNgayHoaDon = "";
        private string mSoChungTuThamChieu = "";
        private string mSoHoaDon = "";
        private string mSoSeri = "";
        private double mSoTien = 0.0;
        private double mSoTienNT = 0.0;
        private string mTenDoiTuongThue = "";
        private double mTienThue = 0.0;
        private double mTienThueNT = 0.0;
        private double mTyGia = 0.0;
        private int mTyLeThue = 0;
        private string mVe = "";

        public bool Load(string pKhoa)
        {
            bool flag=false;
            try
            {
                string commandText = "SELECT * FROM GL_ChungTuTongHopChiTiet WHERE Khoa = '" + pKhoa + "'";
                IDataReader dataReader = DBHelper.ExecuteReader(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]);
                if (dataReader.Read())
                {
                    this.mKhoa = Conversions.ToString(modGeneral.GetValue(dataReader, 0, modGeneral.typeOfColumn.GetString));
                    this.mKhoaChungTu = Conversions.ToString(modGeneral.GetValue(dataReader, 1, modGeneral.typeOfColumn.GetString));
                    this.mLoaiTien = Conversions.ToString(modGeneral.GetValue(dataReader, 2, modGeneral.typeOfColumn.GetString));
                    this.mTyGia = Conversions.ToDouble(modGeneral.GetValue(dataReader, 3, modGeneral.typeOfColumn.GetDecimal));
                    this.mSoTienNT = Conversions.ToDouble(modGeneral.GetValue(dataReader, 4, modGeneral.typeOfColumn.GetDecimal));
                    this.mSoTien = Conversions.ToDouble(modGeneral.GetValue(dataReader, 5, modGeneral.typeOfColumn.GetDecimal));
                    this.mDienGiai = Conversions.ToString(modGeneral.GetValue(dataReader, 6, modGeneral.typeOfColumn.GetString));
                    this.mKhoaDoiTuong = Conversions.ToString(modGeneral.GetValue(dataReader, 7, modGeneral.typeOfColumn.GetString));
                    this.mKhoaBoPhan = Conversions.ToString(modGeneral.GetValue(dataReader, 8, modGeneral.typeOfColumn.GetString));
                    this.mKhoaSanPham = Conversions.ToString(modGeneral.GetValue(dataReader, 9, modGeneral.typeOfColumn.GetString));
                    this.mKhoaHopDong = Conversions.ToString(modGeneral.GetValue(dataReader, 10, modGeneral.typeOfColumn.GetString));
                    this.mKhoaDoiTuongThue = Conversions.ToString(modGeneral.GetValue(dataReader, 11, modGeneral.typeOfColumn.GetString));
                    this.mTenDoiTuongThue = Conversions.ToString(modGeneral.GetValue(dataReader, 12, modGeneral.typeOfColumn.GetString));
                    this.mMaSoThue = Conversions.ToString(modGeneral.GetValue(dataReader, 13, modGeneral.typeOfColumn.GetString));
                    this.mDiaChiThue = Conversions.ToString(modGeneral.GetValue(dataReader, 14, modGeneral.typeOfColumn.GetString));
                    this.mKhoaLoaiThue = Conversions.ToString(modGeneral.GetValue(dataReader, 15, modGeneral.typeOfColumn.GetString));
                    this.mTyLeThue = Conversions.ToInteger(modGeneral.GetValue(dataReader, 0x10, modGeneral.typeOfColumn.GetInt32));
                    this.mTienThueNT = Conversions.ToDouble(modGeneral.GetValue(dataReader, 0x11, modGeneral.typeOfColumn.GetDecimal));
                    this.mTienThue = Conversions.ToDouble(modGeneral.GetValue(dataReader, 0x12, modGeneral.typeOfColumn.GetDecimal));
                    this.mSoHoaDon = Conversions.ToString(modGeneral.GetValue(dataReader, 0x13, modGeneral.typeOfColumn.GetString));
                    this.mNgayHoaDon = Conversions.ToString(modGeneral.GetValue(dataReader, 20, modGeneral.typeOfColumn.GetString));
                    this.mSoSeri = Conversions.ToString(modGeneral.GetValue(dataReader, 0x15, modGeneral.typeOfColumn.GetString));
                    this.mKhoaChungTuThamChieu = Conversions.ToString(modGeneral.GetValue(dataReader, 0x16, modGeneral.typeOfColumn.GetString));
                    this.mSoChungTuThamChieu = Conversions.ToString(modGeneral.GetValue(dataReader, 0x17, modGeneral.typeOfColumn.GetString));
                    this.mNgayChungTuThamChieu = Conversions.ToString(modGeneral.GetValue(dataReader, 0x18, modGeneral.typeOfColumn.GetString));
                    this.mKhoaTaiKhoan = Conversions.ToString(modGeneral.GetValue(dataReader, 0x19, modGeneral.typeOfColumn.GetString));
                    this.mKhoaTaiKhoanThue = Conversions.ToString(modGeneral.GetValue(dataReader, 0x1a, modGeneral.typeOfColumn.GetString));
                    this.mKhoaLoaiChungTu = Conversions.ToString(modGeneral.GetValue(dataReader, 0x1b, modGeneral.typeOfColumn.GetString));
                    this.mVe = Conversions.ToString(modGeneral.GetValue(dataReader, 0x1c, modGeneral.typeOfColumn.GetString));
                }
                dataReader.Close();
                flag = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        public bool Save()
        {
            bool flag=false;
            IDataParameter[] commandParameters = new IDataParameter[0x1d];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@Khoa", DbType.Int64, ParameterDirection.Input, this.mKhoa);
                commandParameters[1] = DBHelper.createParameter("@KhoaPhieuThu", DbType.Int64, ParameterDirection.Input, this.mKhoaChungTu);
                commandParameters[2] = DBHelper.createParameter("@LoaiTien", DbType.Int64, ParameterDirection.Input, this.mLoaiTien);
                commandParameters[3] = DBHelper.createParameter("@TyGia", DbType.Date, ParameterDirection.Input, this.mTyGia);
                commandParameters[4] = DBHelper.createParameter("@SoTienNT", DbType.Date, ParameterDirection.Input, this.mSoTienNT);
                commandParameters[5] = DBHelper.createParameter("@SoTien", DbType.Date, ParameterDirection.Input, this.mSoTien);
                commandParameters[6] = DBHelper.createParameter("@DienGiai", DbType.Int64, ParameterDirection.Input, this.mDienGiai);
                commandParameters[7] = DBHelper.createParameter("@KhoaDoiTuong", DbType.Int64, ParameterDirection.Input, this.mKhoaDoiTuong);
                commandParameters[8] = DBHelper.createParameter("@KhoaBoPhan", DbType.Int64, ParameterDirection.Input, this.mKhoaBoPhan);
                commandParameters[9] = DBHelper.createParameter("@KhoaSanPham", DbType.Int64, ParameterDirection.Input, this.mKhoaSanPham);
                commandParameters[10] = DBHelper.createParameter("@KhoaHopDong", DbType.Int64, ParameterDirection.Input, this.mKhoaHopDong);
                commandParameters[11] = DBHelper.createParameter("@KhoaDoiTuongThue", DbType.Int64, ParameterDirection.Input, this.mKhoaDoiTuongThue);
                commandParameters[12] = DBHelper.createParameter("@TenDoiTuongThue", DbType.Int64, ParameterDirection.Input, this.mTenDoiTuongThue);
                commandParameters[13] = DBHelper.createParameter("@MaSoThue", DbType.Int64, ParameterDirection.Input, this.mMaSoThue);
                commandParameters[14] = DBHelper.createParameter("@DiaChiThue", DbType.Int64, ParameterDirection.Input, this.mDiaChiThue);
                commandParameters[15] = DBHelper.createParameter("@KhoaLoaiThue", DbType.Int64, ParameterDirection.Input, this.mKhoaLoaiThue);
                commandParameters[0x10] = DBHelper.createParameter("@TyLeThue", DbType.Double, ParameterDirection.Input, this.mTyLeThue);
                commandParameters[0x11] = DBHelper.createParameter("@TienThueNT", DbType.Date, ParameterDirection.Input, this.mTienThueNT);
                commandParameters[0x12] = DBHelper.createParameter("@TienThue", DbType.Date, ParameterDirection.Input, this.mTienThue);
                commandParameters[0x13] = DBHelper.createParameter("@SoHoaDon", DbType.Int64, ParameterDirection.Input, this.mSoHoaDon);
                commandParameters[20] = DBHelper.createParameter("@NgayHoaDon", DbType.Int64, ParameterDirection.Input, this.mNgayHoaDon);
                commandParameters[0x15] = DBHelper.createParameter("@SoSeri", DbType.Int64, ParameterDirection.Input, this.mSoSeri);
                commandParameters[0x16] = DBHelper.createParameter("@KhoaChungTu", DbType.Int64, ParameterDirection.Input, this.mKhoaChungTuThamChieu);
                commandParameters[0x17] = DBHelper.createParameter("@SoChungTu", DbType.Int64, ParameterDirection.Input, this.mSoChungTuThamChieu);
                commandParameters[0x18] = DBHelper.createParameter("@NgayChungTu", DbType.Int64, ParameterDirection.Input, this.mNgayChungTuThamChieu);
                commandParameters[0x19] = DBHelper.createParameter("@KhoaTaiKhoan", DbType.Int64, ParameterDirection.Input, this.mKhoaTaiKhoan);
                commandParameters[0x1a] = DBHelper.createParameter("@KhoaTaiKhoanThue", DbType.Int64, ParameterDirection.Input, this.mKhoaTaiKhoanThue);
                commandParameters[0x1b] = DBHelper.createParameter("@KhoaLoaiChungTu", DbType.Int64, ParameterDirection.Input, this.mKhoaLoaiChungTu);
                commandParameters[0x1c] = DBHelper.createParameter("@Ve", DbType.Int64, ParameterDirection.Input, this.mVe);
                if (DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.StoredProcedure, "GL_sp_ChungTuTongHopChiTiet", commandParameters) > 0)
                {
                    return true;
                }
                flag = false;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return flag;
        }

        public string DiaChiThue
        {
            get
            {
                return this.mDiaChiThue;
            }
            set
            {
                this.mDiaChiThue = value;
            }
        }

        public string DienGiai
        {
            get
            {
                return this.mDienGiai;
            }
            set
            {
                this.mDienGiai = value;
            }
        }

        public string Khoa
        {
            get
            {
                return this.mKhoa;
            }
            set
            {
                this.mKhoa = value;
            }
        }

        public string KhoaBoPhan
        {
            get
            {
                return this.mKhoaBoPhan;
            }
            set
            {
                this.mKhoaBoPhan = value;
            }
        }

        public string KhoaChungTu
        {
            get
            {
                return this.mKhoaChungTu;
            }
            set
            {
                this.mKhoaChungTu = value;
            }
        }

        public string KhoaChungTuThamChieu
        {
            get
            {
                return this.mKhoaChungTuThamChieu;
            }
            set
            {
                this.mKhoaChungTuThamChieu = value;
            }
        }

        public string KhoaDoiTuong
        {
            get
            {
                return this.mKhoaDoiTuong;
            }
            set
            {
                this.mKhoaDoiTuong = value;
            }
        }

        public string KhoaDoiTuongThue
        {
            get
            {
                return this.mKhoaDoiTuongThue;
            }
            set
            {
                this.mKhoaDoiTuongThue = value;
            }
        }

        public string KhoaHopDong
        {
            get
            {
                return this.mKhoaHopDong;
            }
            set
            {
                this.mKhoaHopDong = value;
            }
        }

        public string KhoaLoaiChungTu
        {
            get
            {
                return this.mKhoaLoaiChungTu;
            }
            set
            {
                this.mKhoaLoaiChungTu = value;
            }
        }

        public string KhoaLoaiThue
        {
            get
            {
                return this.mKhoaLoaiThue;
            }
            set
            {
                this.mKhoaLoaiThue = value;
            }
        }

        public string KhoaSanPham
        {
            get
            {
                return this.mKhoaSanPham;
            }
            set
            {
                this.mKhoaSanPham = value;
            }
        }

        public string KhoaTaiKhoan
        {
            get
            {
                return this.mKhoaTaiKhoan;
            }
            set
            {
                this.mKhoaTaiKhoan = value;
            }
        }

        public string KhoaTaiKhoanThue
        {
            get
            {
                return this.mKhoaTaiKhoanThue;
            }
            set
            {
                this.mKhoaTaiKhoanThue = value;
            }
        }

        public string LoaiTien
        {
            get
            {
                return this.mLoaiTien;
            }
            set
            {
                this.mLoaiTien = value;
            }
        }

        public string MaSoThue
        {
            get
            {
                return this.mMaSoThue;
            }
            set
            {
                this.mMaSoThue = value;
            }
        }

        public string NgayChungTuThamChieu
        {
            get
            {
                return this.mNgayChungTuThamChieu;
            }
            set
            {
                this.mNgayChungTuThamChieu = value;
            }
        }

        public string NgayHoaDon
        {
            get
            {
                return this.mNgayHoaDon;
            }
            set
            {
                this.mNgayHoaDon = value;
            }
        }

        public string SoChungTuThamChieu
        {
            get
            {
                return this.mSoChungTuThamChieu;
            }
            set
            {
                this.mSoChungTuThamChieu = value;
            }
        }

        public string SoHoaDon
        {
            get
            {
                return this.mSoHoaDon;
            }
            set
            {
                this.mSoHoaDon = value;
            }
        }

        public string SoSeri
        {
            get
            {
                return this.mSoSeri;
            }
            set
            {
                this.mSoSeri = value;
            }
        }

        public double SoTien
        {
            get
            {
                return this.mSoTien;
            }
            set
            {
                this.mSoTien = value;
            }
        }

        public double SoTienNT
        {
            get
            {
                return this.mSoTienNT;
            }
            set
            {
                this.mSoTienNT = value;
            }
        }

        public string TenDoiTuongThue
        {
            get
            {
                return this.mTenDoiTuongThue;
            }
            set
            {
                this.mTenDoiTuongThue = value;
            }
        }

        public double TienThue
        {
            get
            {
                return this.mTienThue;
            }
            set
            {
                this.mTienThue = value;
            }
        }

        public double TienThueNT
        {
            get
            {
                return this.mTienThueNT;
            }
            set
            {
                this.mTienThueNT = value;
            }
        }

        public double TyGia
        {
            get
            {
                return this.mTyGia;
            }
            set
            {
                this.mTyGia = value;
            }
        }

        public int TyLeThue
        {
            get
            {
                return this.mTyLeThue;
            }
            set
            {
                this.mTyLeThue = value;
            }
        }

        public string Ve
        {
            get
            {
                return this.mVe;
            }
            set
            {
                this.mVe = value;
            }
        }
    }
}

